/* Runge-Kutta method, etc. */
float h=0.01;
struct VecDE
{
    float Dx;
    float x;
    float t;
    VecDE operator+(VecDE another);
};
VecDE monster, beast;

VecDE vMake(float Dx, float x, float t)
{
    beast.Dx = Dx;
    beast.x = x;
    beast.t = t;
    return beast;
}

VecDE VecDE::operator+(VecDE another)
{
    monster=vMake(0,0,0);
    monster.Dx = Dx + another.Dx;
    monster.x = x + another.x;
    monster.t = t + another.t;
    return monster;
}

VecDE RK4(VecDE old, float f1(VecDE v1))
{
    float M[4],K[4];
    M[0]=h*f1(old);
    K[0]=h*old.Dx;
    M[1]=h*f1(old+vMake(M[0]/2,K[0]/2,h/2));
    K[1]=h*(old.Dx+M[0]/2);
    M[2]=h*f1(old+vMake(M[1]/2,K[1]/2,h/2));
    K[2]=h*(old.Dx+M[1]/2);
    M[3]=h*f1(old+vMake(M[2],K[2],h));
    K[3]=h*(old.Dx+M[2]);
    float dM=(M[0]+2*M[1]+2*M[2]+M[3])/6,
          dK=(K[0]+2*K[1]+2*K[2]+K[3])/6;
    return old+vMake(dM,dK,h);
}
